const {spawnSync} = require('child_process');
module.exports=function(command,args=[],path,encoding='utf8'){

  path = path || process.cwd();

  let {error=null,stdout=null,stderr=null} = spawnSync(command,args,{cwd:path,encoding});

  if(error || stderr)return {result:false,error,stdout,stderr};

  return {result:true,error,stdout,stderr}
  
}